﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class liuyan_detail : System.Web.UI.Page
{
// 2 请求参数成员变量列表
﻿    public string id = "";
﻿    public string biaoti = "";
﻿    public string neirong = "";
﻿    public string liuyanshijian = "";
﻿    public string usersid = "";
﻿    public string huifu = "";



// 6.1 父列请求参数成员变量列表
﻿    public string f_usersloginname = "";



    //初始化当前时间
    public string current_shijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Trim();
    //初始化当前日期
    public string current__riqi = DateTime.Now.ToString("yyyy-MM-dd").Trim();
    
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString().Trim() != "")
        {
            id = Request.QueryString["id"].ToString().Trim();
        }
        else
        {
            Response.Write("<script>javascript:alert('对不起,信息id参数不能为空，请重新操作!');history.back();</script>");
            Response.End();
        }

        if (!IsPostBack)
        {
            string sql;
            sql = "select * from liuyan where id=" + Request.QueryString["id"].ToString().Trim();
            getdata(sql);
        }
    }



    private void getdata(string sql)
    {
        DataSet dsresult = new DataSet();
        dsresult = new Class1().hsggetdata(sql);
        if (dsresult != null)
        {
            if (dsresult.Tables[0].Rows.Count > 0)
            {
            
//3 初始化参数列表
﻿                id = dsresult.Tables[0].Rows[0]["id"].ToString().Trim();
﻿                biaoti = dsresult.Tables[0].Rows[0]["biaoti"].ToString().Trim();
﻿                neirong = dsresult.Tables[0].Rows[0]["neirong"].ToString().Trim();
﻿                liuyanshijian = dsresult.Tables[0].Rows[0]["liuyanshijian"].ToString().Trim();
﻿                usersid = dsresult.Tables[0].Rows[0]["usersid"].ToString().Trim();
                if (usersid.ToString().Trim() != "")
                {
                    f_usersloginname = getFatherSecondColumnValue("users", "loginname", dsresult.Tables[0].Rows[0]["usersid"].ToString().Trim());
                }
﻿                huifu = dsresult.Tables[0].Rows[0]["huifu"].ToString().Trim();
            }
        }
    }

    private string getFatherSecondColumnValue(string fatherTable, string fatherSecondColumnName, string fatherIdColumnVaule)
    {
        string fatherSecondColumnValue = "";
        string sql;
        sql = "select " + fatherSecondColumnName + " from " + fatherTable + " where 1=1 and id='" + fatherIdColumnVaule + "' order by id desc";

        DataSet dsresult = new DataSet();
        dsresult = new Class1().hsggetdata(sql);
        if (dsresult != null)
        {
            if (dsresult.Tables[0].Rows.Count > 0)
            {
                fatherSecondColumnValue = dsresult.Tables[0].Rows[0][0].ToString().Trim();
            }
        }

        return fatherSecondColumnValue;
    }

}

